from django.shortcuts import render

# Create your views here.

from rest_framework.views import APIView
from rest_framework.response import Response
from home import models,homeser

class Header(APIView):
    def get(self, request):
        navdata = models.Nav.objects.filter(position=1,isdel= False).order_by('sort')
        ser = homeser.HomeSerializer(navdata, many=True)
        return Response({'message': 'Hello World','data': ser.data})

class Footer(APIView):
    def get(self, request):
        navdata = models.Nav.objects.filter(position=1,isdel= False).order_by('sort')
        ser = homeser.HomeSerializer(navdata, many=True)
        return Response({'message': 'Hello World','data': ser.data})

class Banner(APIView):
    def get(self, request):
        navdata = models.Banner.objects.filter(isdel=False).order_by('sort')
        ser = homeser.BannerSerializer(navdata, many=True)
        return Response({'message': 'Hello World','data': ser.data})